package com.example.myapplication.view;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

/**
 * 对Padding属性和wrap_content做处理
 * 作者：李祥
 * 邮箱：499194689@qq.com
 */

public class TestView07 extends View {
    Paint paint=new Paint(Paint.ANTI_ALIAS_FLAG);
    public TestView07(Context context) {
        super(context);
        initDraw();
    }


    public TestView07(Context context,  AttributeSet attrs) {
        super(context, attrs);
        initDraw();
    }

    public TestView07(Context context,  AttributeSet attrs, int defStyleAttr) {
        super(context, attrs, defStyleAttr);
        initDraw();
    }


     void initDraw(){
        paint.setColor(Color.RED);
     }
    @SuppressLint("NewApi")
    @Override
    protected void onDraw(Canvas canvas) {
        super.onDraw(canvas);

        canvas.drawArc(100, 100, 300, 300, 0, 50, true, paint); // 绘制扇形
        paint.setColor(Color.BLUE);
        canvas.drawArc(100, 100, 300, 300, 50, 60, true, paint);
        paint.setColor(Color.DKGRAY);
        canvas.drawArc(100,100,300,300,110,100,true,paint);
        paint.setColor(Color.BLUE);
        canvas.drawArc(100,100,300,300,210,150,true,paint);





    }
}